package com.shenjun.controller;

import com.shenjun.config.UnionApiConfig;
import com.shenjun.config.UnionServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("send")
@Slf4j
public class SendMsgController {


    @Autowired
    private UnionServer unionServer;

    @Autowired
    private UnionApiConfig unionApiConfig;

    @GetMapping("/send001")
    public String send001(@RequestParam(value = "msg") String msg) {
        log.info("get-send001:[{}]",msg);

        log.info("unionServerName:[{}],unionServerIp:[{}],unionServerPort:[{}]",
                unionServer.getName(),unionServer.getIp(),unionServer.getPort());
        log.info(unionApiConfig.getApi().toString());
        return "收到" + msg;
    }

    @PostMapping("/send002")
    public String send002(@RequestBody String msg) {
        log.info("post-send002:[{}]",msg);
        return msg;
    }
}
